package com.exp.base.util;

import com.exp.base.FastException;

public class ExceptionUtils extends org.apache.commons.lang3.exception.ExceptionUtils {
	/**
	 * 是否使用高性能异常
	 */
	public static boolean fast;
	/**
	 * 抛出高性能异常
	 * @param message
	 */
	public static void throwFastException(String message){
		throw new FastException(message);
	}
	/**
	 * 抛出高性能异常
	 * @param message
	 */
	public static void throwFastException(Throwable throwable){
		throw new FastException(throwable);
	}
	/**
	 * 抛出高性能异常
	 * @param message
	 */
	public static void throwFastException(String message,Throwable throwable){
		throw new FastException(message,throwable);
	}
	/**
	 * 抛出普通runtime异常
	 * @param message
	 */
	public static void throwRuntimeException(String message){
		throw new RuntimeException(message);
	}
	/**
	 * 抛出普通runtime异常
	 * @param message
	 */
	public static void throwRuntimeException(Throwable throwable){
		throw new RuntimeException(throwable);
	}
	/**
	 * 抛出普通runtime异常
	 * @param message
	 */
	public static void throwRuntimeException(String message,Throwable throwable){
		throw new RuntimeException(message,throwable);
	}
	/**
	 * 根据标志位fast，抛出普通runtime异常/高性能异常
	 * @param message
	 */
	public static void throwException(String message){
		if(fast){
			throw new FastException(message);
		}else{
			throw new RuntimeException(message);
		}
	}
	/**
	 * 根据标志位fast，抛出普通runtime异常/高性能异常
	 * @param message
	 */
	public static void throwException(Throwable throwable){
		if(fast){
			throw new FastException(throwable);
		}else{
			throw new RuntimeException(throwable);
		}
	}
	/**
	 * 根据标志位fast，抛出普通runtime异常/高性能异常
	 * @param message
	 */
	public static void throwException(String message,Throwable throwable){
		if(fast){
			throw new FastException(message,throwable);
		}else{
			throw new RuntimeException(message,throwable);
		}
	}
	
	
	
	
}
